package cn.tedu.submarine;

import javax.swing.*;

//战舰
public class Battleship extends SeaObject {

    private int life;

    //Battleship的构造方法
    public Battleship() {
        super(66,26,270,125,20);
        life = 5;
    }
    //重写move(),
    public void move(){}
    //重写getImage()获取图片
    public ImageIcon getImage(){
        return Images.battleship1;
    }


    //shotBmob   发射深水炸弹(生成炸弹对象)
    public Bomb shotBmob(){
        return new Bomb(this.x+30,this.y+30);
    }
    /**左移动方法*/
    public void moveLeft(){
        x-=speed;
    }
    /**右移方法*/
    public void moveRight(){
        x+=speed;
    }
    /**下右移方法*/
    public void moveDown(){
        y+=speed;
    }
    /**上移方法*/
    public void moveup(){
        y-=speed;
    }
    /**战舰增命*/
    public void addLife(int num){
        life +=num;
    }
    /**获取战舰命数*/
    public int getLife(){
        return  life;
    }
    /**战舰减命*/
    public void subtractLife(){
        life--;//命数减一
    }
}
